import log4js from 'log4js'
import { app } from 'electron'
import path from 'path';

const filePath = path.join(app.getPath('userData'), 'logs/app.log')

log4js.configure({
  appenders: {
    out: { type: 'stdout' },
    app: { type: 'file', filename: filePath, maxLogSize: '20M' },
  },
  categories: {
    default: {
      appenders: [ 'out', 'app' ],
      level: 'debug'
    }
  }
})

export default {
  getLogger: log4js.getLogger,
  shutdown: log4js.shutdown
}
